﻿using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entity
{
    /// <summary>
    /// 告诉我们如何数据库
    /// </summary>
    public class AIYDbContextFactioy : IDesignTimeDbContextFactory<AIYDbContext>
    {
        public AIYDbContext CreateDbContext(string[] args)
        {
            var optionBuilder = new DbContextOptionsBuilder<AIYDbContext>();
            optionBuilder.UseMySql("server=localhost;userid=root;password=123456;database=AIYDB;",
                new MySqlServerVersion(new Version(8, 0, 41))
                );
            return new AIYDbContext(optionBuilder.Options);
        }
    }
}
